package com.wl156.activities;

import java.io.IOException;

import org.xmlpull.v1.XmlPullParserException;

import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import com.wl156.R;
import com.wl156.activities.find.FindResultBase;
import com.wl156.adapters.ZhuanZhangAdapter;

public class ZhuanZhangHistory extends FindResultBase {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		mHeaderStub.setLayoutResource(R.layout.item_zhuanzhang_header);
		mHeaderStub.inflate();

		hideBottomButtons();

		new FindTask(type).execute();
	}

	@Override
	protected String getFindName() {
		return "转账历史";
	}

	@Override
	protected Class getFindResultActivity() {
		return null;
	}

	@Override
	protected Class getFindActivity() {
		return null;
	}

	@Override
	protected int getPhoneIndex() {
		return 0;
	}

	@Override
	protected Class getAdapter() {
		return ZhuanZhangAdapter.class;
	}

	public class FindTask extends FindTaskBase {
		public FindTask(int type) {
			super(type);
		}

		@Override
		protected void onLoadFailed() {
			super.onLoadFailed();

			new FindTask(type).execute();
		}

		@Override
		protected Object doInBackground(Void... params) {
			try {
				return mWebServiceClient.common_getMyPayLog(mCertificate,
						mCurrentPageIndex, countPerPage);
			} catch (IOException e) {
				return e;
			} catch (XmlPullParserException e) {
				return e;
			}
		}
	}

	@Override
	protected void onLastItemVisible() {
		super.onLastItemVisible();

		new FindTask(type).execute();
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
	}
}
